﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>微街秀 > 登录</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=no" />
    <link rel="shortcut icon" href=" /favicon.ico" />
    <link rel="stylesheet" type="text/css" href="css/css.css" />
    <link href="css/login.css" rel="stylesheet" type="text/css" />
    <script src="js/jquery-2.1.4.min.js" type="text/javascript"></script>
    <script src="js/base.js" type="text/javascript"></script>
    <script src="js/dialog.js" type="text/javascript"></script>
    <script>
        $(document).ready(function () {
            Oauth();
            $('#submits').click(function () { submits(); });

            var $inp = $('#submits');
            var $user = $('#name');
            var $pwd = $('#pwd');


            $user.bind('keydown', function (e) {
                var key = e.which;
                if (key == 13) {
                    e.preventDefault();
                    $pwd.focus();
                }
            });


            $pwd.bind('keydown', function (e) {
                var key = e.which;
                if (key == 13) {
                    e.preventDefault();
                    submits();
                }
            });

            $inp.bind('keydown', function (e) {
                var key = e.which;
                if (key == 13) {
                    e.preventDefault();
                    submits();
                }
            });
            window.onload = function () {
                if ($("#name").val() != "" || $("#pwd").val() != "") {

                    $('#submits').focus();
                }
                else {
                    $("#name").focus();
                }

            }

            $("#showpwd").click(function () {
                if ($("#showpwd").attr("src") == "img/hidden.png") {
                    $("#showpwd").attr("src", "img/show.png")
                    $("#pwd").attr("type", "text");
                }
                else {
                    $("#showpwd").attr("src", "img/hidden.png")
                    $("#pwd").attr("type", "password");
                }
            });
        });
        function submits() {
            var param = { "login_type": 1, "name": $('#name').val(), "pwd": $('#pwd').val() };
            if (!check(param)) return false;           
            Alert("正在登录...");
            $.post("ajax/user.ashx?login", param, function (data) {
                if (data.code == 0)
                    GoPage(1, data.item.id, data.item.token, data.item.parent_id);
                else
                    Alert(data.msg)
            },
            "json");
        }

        function Oauth() {
            var action = getUrlArgStr("action");
            var token = getUrlArgStr("token");
            var userid = getUrlArgStr("user_id");
            var parentid = getUrlArgStr("parentid");
            var code = getUrlArgStr("code");
            if (code == "1005" || (action == "oauth" && userid == "")) {
                Alert("您的账户已停用");
                return false;
            }
            delCookie('a');
            delSession('a');
            if (action == "oauth" && token != "" && userid != "") {
                GoPage(2, userid, token, parentid);
                return true;
            }
            return false;
        }

        function check(param) {
            if (param.name == "") {
                Alert("请输入账号");
                $('#name').focus();
                return false;
            }
            if (param.pwd == "") {
                Alert("请输入密码");
                $('#pwd').focus();
                return false;
            }
            return true;
        }
    </script>
</head>
<body>
    <div class="wamtop">
        <div class="topleft">
            <a href="javascript:" onclick="window.location.href='index.html'">
                <img src="img/5.jpg">
            </a>
        </div>
        <div class="topcententxt">
            登 录</div>
    </div>
    <div class="box1">
        <input type="text" id="name" name="name" class="input0" placeholder="用户名">
    </div>
    <div class="box1">
        <input type="password" id="pwd" name="pwd" class="input0" placeholder="密码">
        <img src="img/hidden.png" id="showpwd" />
    </div>
    <div class="box2">
        <div id="submits" class="input2">
            登 录</div>
    </div>
    <div class="boxone">
        <div class="wordone" onclick="window.location.href='registered.html'">
            立即注册</div>
        <div class="wordtwo" onclick="window.location.href='Forgot.html'">
            忘记密码</div>
    </div>
    <div class="kuang">
        <div class="wenzi">
            一键登录</div>
    </div>
    <div class="divlogin">
        <div class="loginQQ" style="background-color: #2C90CE;">
            <a href="/api/oauth/qqlogin.ashx?login">
                <img src="img/40.png" /></a>
        </div>
        <div class="loginWeixin" style="background-color: #3AB737;">
            <a href="/api/oauth/wxlogin.ashx?login">
                <img src="img/41.png" /></a>
        </div>
    </div>
</body>
</html>
